<%@page import="cn.com.common.base.bean.BackstageResult"%>
<%@page import="cn.com.common.Constants"%>
<%@page import="com.sun.tools.javac.code.Attribute.Constant"%>
<%@page import="java.util.Map"%>
<%@page import="com.opensymphony.xwork2.util.ValueStack"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>测试例子 修改</title>
<%@include file="/WEB-INF/page/commons/import.jsp" %> 
<%@include file="/WEB-INF/page/commons/calendar2.jsp" %> 

<%
BackstageResult bResult = (BackstageResult)request.getAttribute(Constants.SYSTEM_ACTION_RESUT_MSG);
if(bResult!=null){
	if(bResult.isStatus() && Integer.valueOf(1).equals(bResult.getMsg())){
		%>
		<script type="text/javascript">
			alert("操作成功");
			window.location.href = path + "/demo/annotation/demoAnnotaionUser/toIndex";
		</script>
		<%
	}else{
		%>
		<script type="text/javascript">
			alert("操作失败,<%=bResult.getMsg()%>");
		</script>
		<%
	}
}
%>

<script type="text/javascript">
$(function(){
	var maxDate = Calendar.dateToInt(new Date());
	Calendar.setup({
	    inputField : "oprBean_birthday",
	    trigger    : "oprBean_birthday",
	    max: maxDate,
	    onSelect   : function() { this.hide() }
	});
})

function backList(targetBt){
	$(targetBt).attr("disabled",true);
	showCustomDiv(true, "apdiv", 1, true);
	var form = $("#backListForm");
	form.submit();
}

function save(targetBt){
	$(targetBt).attr("disabled",true);
	showCustomDiv(true, "apdiv", 1, true);
	var form = $("#editForm");
	form.submit();
}
</script>
</head>
<body>
	<div>
		<s:if test="#system_action_result_msg!=null">
			<s:property value="#system_action_result_msg.toString()"/>
		</s:if>
	</div>
	 
	<s:form action="save" validate="true" id="editForm" method="post" namespace="/demo/annotation/demoAnnotaionUser">
		<s:hidden name="oprBean.id"></s:hidden>
		<table>
			<tr>
				<td>
					<s:label value="用户名"></s:label>
				</td>
				<td>
					<s:textfield name="oprBean.userName" ></s:textfield>
				</td>
				<td>
					<span style="color: red;">
						 ${ FieldErrors['oprBean.userName'][0]}
					</span>
				</td>
			</tr>
			<tr>
				<td>
					<s:label value="性别"></s:label>
				</td>
				<td>
					<s:radio list="#{'1':'男','0':'女'}" name="oprBean.sex"></s:radio>
				</td>
				<td>
					<span style="color: red;">
						 ${ FieldErrors['oprBean.sex'][0]}
					</span>
				</td>
			</tr>
			<tr>
				<td>
					<s:label value="生日"></s:label>
				</td>
				<td>
					<s:textfield name="oprBean.birthday" id="oprBean_birthday">
					</s:textfield>
				</td>
				<td>
					<span style="color: red;">
						 ${ FieldErrors['oprBean.birthday'][0]}
					</span>
				</td>
			</tr>
			<tr>
				<td>
					<s:label value="年龄"></s:label>
				</td>
				<td>
					<s:textfield name="oprBean.age"></s:textfield>
				</td>
				<td>
					 ${ FieldErrors['oprBean.age'][0]}
				</td>
			</tr>
			<tr>
				<td>
					<s:label value="邮箱"></s:label>
				</td>
				<td>
					<s:textfield name="oprBean.email">
					</s:textfield>
				</td>
				<td>
				<%--
					<s:fielderror fieldName="oprBean.email" theme="simple"></s:fielderror>
				 --%>
				 ${ FieldErrors['oprBean.email'][0]}
				 	<%--
				 	ValueStack valueStack =(ValueStack)request.getAttribute("struts.valueStack");
				 	 out.print( ((Map)valueStack.findValue("FieldErrors")).get("oprBean.email"));
				 	--%>
				</td>
			</tr>
			
			<tr>
				<td colspan="2">
					<input type="button" value="保存" onclick="save(this)">
					<input type="button" value="返回列表" onclick="backList(this)">
				</td>
			</tr>
		</table>
	</s:form>
	
	
	<s:form id="backListForm" action="toIndex"  namespace="/demo/annotation/demoAnnotaionUser">
	
	</s:form>
	
	<div id="apdiv"
				style="z-index: 5; position: absolute; display: none; background: #FFFFFF; border: 1px solid #000000; height: 200px; width: 300px; text-align: center">
		<br /><br /><br /><br /><br /><br /><br />
		<div>正在执行，请稍等...</div>
	</div>
</body>
</html>